package org.kjtc.service;

import org.kjtc.entity.Log;
import org.kjtc.mapper.LogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.UUID;

@Service
public class LogService {

    @Autowired
    private LogMapper logMapper;

    public void insertLog(String LogContext,String UserName){
        try{
            String LogID = new SimpleDateFormat("yyyymmddhhmmss").format(new Date());
            LogID += UUID.randomUUID().toString();
            int insertStatus = logMapper.insertLog(LogID,LogContext,UserName);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    public List<Log> getLogMessage(Log log){
        List<Log> logList = logMapper.getLogMessage(log);
        return logList;
    }
}
